﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GoodsList.aspx.cs" Inherits="Myproject.BSM.PcWeb.PcChannel.Product.GoodsList" %>

<div class="bjui-pageHeader">
<form id="pagerForm" data-toggle="ajaxsearch" action="/bsm/pcweb/PcChannel/Product/GoodsList.aspx" method="post">
    <div class="bjui-searchBar">
        <ul class="breadcrumb">
            <li><a><i class="fa fa-university"></i> 后台管理中心</a></li>
            <li><a><i class="fa fa-desktop"></i> 电脑端管理</a></li>
            <li class="active"><a><i class="fa fa-list"></i> 产品管理</a></li>
        </ul>
    </div>
    <div class="bjui-searchBar">
        <input id="pc_Channel_GoodsEdit_GoodsClassId" runat="server" name="pc_Channel_GoodsEdit_GoodsClassId" type="hidden" value="" />
        <label>产品类别：</label><input runat="server" runat="server" readonly type="text" name="pc_Channel_GoodsEdit_class" id="pc_Channel_GoodsEdit_class" class="form-control" size="15"  data-title="选择频道" data-toggle="lookup" data-url="/bsm/pcweb/PcChannel/Product/selectGoodsClass.aspx" />
        <button type="submit" class="btn-green" id="pc_channel_newslist_submit" data-icon="search">查询</button>&nbsp;
        <a class="btn btn-orange" href="javascript:;" data-toggle="reloadsearch" data-clear-query="true" data-icon="undo">刷新</a>
        <a class="btn btn-green" href="/bsm/pcweb/PcChannel/Product/GoodsEdit.aspx" data-toggle="navtab"  data-id="pc_channel_GoodsEdit" data-icon="plus">新增产品</a>
    </div>
</form>
</div>
<div class="bjui-pageContent">
    <table class="table table-bordered table-hover table-striped table-top" data-selected-multi="true" style="text-align: center;">
        <%--<caption>...</caption>--%>
        <thead>
            <tr>
                <th width="28" style="text-align: center;">
                </th>
                <th style="text-align: center;" data-order-field="Name">名称
                </th>
                <th style="text-align: center;" data-order-field="OtherName">别名
                </th>
                <th style="text-align: center;" data-order-field="EnName">英文名称
                </th>
                <th style="text-align: center;" data-order-field="GoodsClassID">类别
                </th>
                <th style="text-align: center;" data-order-field="show">状态
                </th>
                <th style="text-align: center;">操作
                </th>
            </tr>
        </thead>
        <tbody>
            <%if (MessageTable != null && MessageTable.Rows.Count > 0)
                  {
                      int i = Int32.Parse(PageSize) * (Int32.Parse(PageCurrent) - 1);
                      foreach (System.Data.DataRow row in MessageTable.Rows)
                      {
                          %>
            <tr>
                <td><%=i+1 %></td>
                <td style="text-align: left;">
                    <%= row["name"] %>
                </td>
                <td style="text-align: left;">
                    <%= row["otherName"] %>
                </td>
                <td style="text-align: center;">
                    <%= row["enName"] %>
                </td>
                <td style="text-align: center;">
                    <%= row["GoodsClassName"] %>
                </td>
                <td style="text-align: center;">
                     <% if (bool.Parse(row["show"].ToString()))
                       { %>
                    <button onclick="javascript:pc_channel_goodslist_js_show('<%= row["GoodsId"] %>',false)" type="button" class="btn btn-green" data-icon="eye">已显示</button>
                    <%}
                       else
                       {
                    %>
                    <button onclick="javascript:pc_channel_goodslist_js_show('<%= row["GoodsId"] %>',true)" type="button" class="btn btn-red" data-icon="eye-slash">已隐藏</button>
                    <%
                       } %>
                </td>
                <td style="text-align: center;">
                    <a class="btn btn-green" href="/bsm/pcweb/PcChannel/Product/GoodsEdit.aspx?id=<%= row["GoodsId"] %>" data-toggle="navtab" data-id="pc_base_navedit" data-title="修改产品">修改</a>
                    <a class="btn btn-red" href="javascript:pc_channel_goodslist_js_delete('<%= row["GoodsId"] %>')">删除</a>

                </td>
            </tr>
            <%
                i++;
                      }
                  }%>
        </tbody>
    </table>
</div>
<div class="bjui-pageFooter">
</div>
<script>
    function pc_channel_goodslist_js_delete(id) {
        $(this).alertmsg('confirm', '确定要删除该产品吗?', {
            okCall: function () {
                $.ajax({
                    type: "post",
                    url: "/bsm/ashx/PcChannel/GoodsDelete.ashx?id=" + id,
                    dataType: "json",
                    beforeSend: function (XMLHttpRequest) {

                    },
                    success: function (data) {
                        if (data.IsError) {
                            $(this).alertmsg('correct', "删除成功，刷新后显示");
                            //$(this).navtab('refresh', 'pc_channel_newslist');
                        }
                        else {
                            $(this).alertmsg('error', data.Message);
                        }
                    },
                    error: function () {
                        $(this).alertmsg('error', '删除失败，请稍后再试！');
                    }
                });
            }
        });
    }

    function pc_channel_goodslist_js_show(id, show) {

        $.ajax({
            type: "post",
            url: "/bsm/ashx/PcChannel/GoodsShow.ashx?id=" + id + "&show=" + show,
            dataType: "json",
            beforeSend: function (XMLHttpRequest) {

            },
            success: function (data) {
                if (data.IsError) {
                    $(this).alertmsg('correct', "修改成功，刷新后显示");
                    //$(this).navtab('refresh', 'pc_channel_newslist');
                }
                else {
                    $(this).alertmsg('error', data.Message);
                }
            },
            error: function () {
                $(this).alertmsg('error', '操作失败，请稍后再试！');
            }
        });
    }

</script>
